#coding:utf-8
from qcloudsms_py import SmsSingleSender
from qcloudsms_py.httpclient import HTTPError

class sendSms(Resource):
    def __init__(self):
        self.appid = "1400243692"
        self.appkey = "143d3979101854744d626c9eaf587850"
        self.ssender = SmsSingleSender(self.appid, self.appkey)
        self.sms_sign = "鸿途四海"
        self.template_id = "397568"
        self.params = ["397568"]  # 当模板没有参数时，`params = []`
    def get(self,phone_num):
        try:
            result = self.ssender.send_with_param(86, phone_num,
                self.template_id, self.params, sign=self.sms_sign, extend="", ext="") 
        except HTTPError as e:
            print(e)
        except Exception as e:
            print(e)
        print(result)